| Conditions | 1 |
| Total Lines | 7 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import * as crypto from 'crypto'; |
||
| 9 | |||
| 10 | public async encrypt(buffer: Buffer): Promise<Buffer> { |
||
| 11 | const iv = crypto.randomBytes(16); |
||
| 12 | const key = await this.getEncryptionKey(); |
||
| 13 | const cipher = crypto.createCipheriv('aes-256-ctr', key, iv); |
||
| 14 | |||
| 15 | return Buffer.concat([iv, cipher.update(buffer), cipher.final()]); |
||
| 16 | } |
||
| 36 |